var parsing = require('gelatin/fast-parsing');  // under test

var log = require('oil/log');

var file = require('file'),
    os = require('os'),
    json = require('json'),
    assert = require('test/assert');

exports.testParseDeps = function() {
  //var code = 'var json = require("json");';
  var code = 'var foo  =  require("json");';
  var d = parsing.parseDeps(code);
  print(json.stringify(d, null, 2));

  var code = 'var foo  =  require("json"), file = require("file");';
  var d = parsing.parseDeps(code);
  print(json.stringify(d, null, 2));

  var code = 'var foo  =  require("json"), file = require("file"); var a;';
  var result  = parsing.parseDeps(code);
  print(json.stringify(result, null, 2));
  print('sliced /' + code.slice(result.offset) + '/');

  print('ERR');
  var code = 'var foo  =  require("json"); var bad = foo("file"); var a;';
  var result  = parsing.parseDeps(code);
  print(json.stringify(result, null, 2));
  print('sliced /' + code.slice(result.offset) + '/');
}

if (require.main === module.id) {
  require("test/runner").run(exports);
}
